package com.onec.service.route.entity;


import com.onec.service.api.enums.ProductEnum;
import com.onec.service.api.enums.StatusEnum;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 业务范围：
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_business_info")
public class BusinessInfo implements Serializable {


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    @Column(name = "version")
    private Integer version;
    /**
     * 业务名称
     */
    @Column(name = "name")
    private String name;
    /**
     * 业务名称
     */
    @Column(name = "product", length = 12)
    @Enumerated(value = EnumType.STRING)
    private ProductEnum product;

    /**
     * 业务编号
     */
    @Column(name = "code", length = 12)
    private String code;
    /**
     * 业务编号
     */
    @Column(name = "creator", length = 32)
    private String creator;
    /**
     * 备注
     */
    @Column(name = "remarks")
    private String remarks;
    /**
     * 创建日期
     */
    @Column(name = "create_time")
    @CreatedDate
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;

    @Column(name = "update_time")
    @LastModifiedDate
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;

    @Column(name = "status", length = 16)
    @Enumerated(EnumType.STRING)
    private StatusEnum status;

    @Column(name = "max_amount", scale = 2)
    private BigDecimal maxAmount;

    @Column(name = "min_amount", scale = 2)
    private BigDecimal minAmount;

    @Column(name = "max_fee", scale = 1)
    private BigDecimal maxFee;

    @Column(name = "min_fee", scale = 1)
    private BigDecimal minFee;


    public BusinessInfo() {
    }

    public BusinessInfo(Integer version, String name, String code, String creator, String remarks, Date createTime,
                        Date updateTime, StatusEnum status, BigDecimal maxAmount, BigDecimal minAmount, BigDecimal maxFee,
                        BigDecimal minFee, ProductEnum product) {
        this.version = version;
        this.name = name;
        this.code = code;
        this.creator = creator;
        this.remarks = remarks;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.status = status;
        this.maxAmount = maxAmount;
        this.minAmount = minAmount;
        this.maxFee = maxFee;
        this.minFee = minFee;
        this.product = product;
    }


}
